<div
    bsModal
    #createOrEditModal="bs-modal"
    (onShown)="onShown()"
    class="modal fade"
    tabindex="-1"
    role="dialog"
    aria-labelledby="createOrEditModal"
    aria-hidden="true"
    [config]="{ backdrop: 'static' }"
>
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <form *ngIf="active" #cardForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="card.id">修改员工信息</span>
                        <span *ngIf="!card.id">新建员工信息</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-6">
                            <label for="cardNumber">卡号<span style="color:red">*</span></label>
                            <input
                                id="cardNumber"
                                #nameInput="ngModel"
                                class="form-control"
                                type="text"
                                name="cardNumber"
                                [(ngModel)]="card.cardNumber"
                                required
                            />
                        </div>
                        <div class="col-md-6">
                            <label for="realName">姓名<span style="color:red">*</span></label>
                            <input
                                id="realName"
                                #nameInput="ngModel"
                                class="form-control"
                                type="text"
                                name="realName"
                                [(ngModel)]="card.realName"
                                required
                            />
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-md-6">
                            <label for="dept">部门</label>
                            <select name="dept" id="dept" class="form-control" [(ngModel)]="card.dept">
                                <option value="">选择一个部门</option>
                                <option *ngFor="let dept of depts" [value]="dept.value">{{ dept.displayText }}</option>
                            </select>
                        </div>
                        <div class="col-md-6">
                            <label for="status">是否启用 <span style="color:red">*</span></label>
                            <select name="status" id="status" class="form-control" [(ngModel)]="card.status" required>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-secondary" (click)="close()">
                        {{ l('Cancel') }}
                    </button>
                    <button
                        type="submit"
                        class="btn btn-primary"
                        [disabled]="!cardForm.form.valid"
                        [buttonBusy]="saving"
                        [busyText]="l('SavingWithThreeDot')"
                    >
                        <i class="fa fa-save"></i> <span>{{ l('Save') }}</span>
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
